import Vue from 'vue'
import App from './App'
import DataJson from '@/common/Json.js'
import store from '@/pages/user/login.js'
import uniList from '@/components/uni-list/uni-list.vue';
import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
import uniIcon from "@/components/uni-icon/uni-icon.vue";

Vue.config.productionTip = false

App.mpType = 'app'

const msg = (title, duration=1500, mask=false, icon='none')=>{
	//统一提示方便全局修改
	if(Boolean(title) === false){
		return;
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}
const json = type=>{
	//模拟异步请求数据
	return new Promise(resolve=>{
		setTimeout(()=>{
			resolve(DataJson[type]);
		}, 500)
	})
}

Vue.component('uni-list', uniList)
Vue.component('uni-list-item', uniListItem)
Vue.component('uni-icon', uniIcon)

Vue.prototype.$store = store;
Vue.prototype.$api = {msg, json};

const app = new Vue({
    ...App
})
app.$mount()
